#ifndef FILECONTEXTMENU_H
#define FILECONTEXTMENU_H

#include <QMenu>
#include <QFileSystemModel>
#include <QDateTime>


class MainWindow;

class FileContextMenu : public QMenu
{
    Q_OBJECT

public:
    explicit FileContextMenu(MainWindow *mainWindow, QFileSystemModel *model, QWidget *parent = nullptr);

    QAction* showMenu(QWidget *view, const QPoint &pos);
    void setCurrentIndex(const QModelIndex &index);
    QModelIndex currentIndex() const;
    void setCurrentView(QWidget *view);

public slots:
    void onOpenTriggered();
    void onCutTriggered();
    void onCopyTriggered();
    void onPasteTriggered();
    void onDeleteTriggered();
    void onRenameTriggered();
    void onNewFolderTriggered();
    void onPropertiesTriggered();

private:
    void initActions();

    MainWindow *m_mainWindow;
    QFileSystemModel *m_model;
    QModelIndex m_currentIndex;
    QWidget *m_currentView;

    QAction *m_openAction;
    QAction *m_cutAction;
    QAction *m_copyAction;
    QAction *m_pasteAction;
    QAction *m_deleteAction;
    QAction *m_renameAction;
    QAction *m_newFolderAction;
    QAction *m_propertiesAction;
    QAction * m_selectAllAction;


    QString m_copiedPath;
    bool m_isCutOperation;
};

#endif // FILECONTEXTMENU_H
